import { defHttp } from '@/utils/http';

export const updateRoleUser = (data: ArtifactRpository.UpdateRoleUserParam) =>
  defHttp.post({ url: '/tool/artifact-user/update/role/user', data });
// 查询制品工具、制品仓库列表(有过滤条件，可以分页)
export const queryArtifactRespositoryPageListFun = (data?: OperationManagement.tableParamsList) =>
  defHttp.post({ url: '/tool/artifact-tool/pageList', data });

// 新增制品工具、制品仓库
export const addArtifactRespositoryPageListFun = (data?: OperationManagement.addArtifactPageListParams) =>
  defHttp.post({ url: '/tool/artifact-tool', data });

// 更新制品工具、制品仓库
export const putArtifactRespositoryPageListFun = (data?: OperationManagement.addArtifactPageListParams) =>
  defHttp.put({ url: '/tool/artifact-tool', data });

// 删除制品工具、制品仓库
export const deleteArtifactRespositoryPageListFun = (artifactToolUuid: number | string) =>
  defHttp.delete({ url: `/tool/artifact-tool/${artifactToolUuid}` });

// 查询制品包列表(有过滤条件，可以分页)
export const queryArtifactRespositoryPackageListFun = (data?: OperationManagement.tableParamsList) =>
  defHttp.post({ url: '/tool/repository-package/pageList', data });

// 删除制品组件
export const deleteArtifactRespositoryPackageListFun = (packageUuid: number | string) =>
  defHttp.delete({ url: `/tool/repository-package/${packageUuid}` });

// 得到仓库指南
export const getRespositoryGuide = (artifactToolUuid: any) =>
  defHttp.get({ url: `/tool/artifact-tool/guide/${artifactToolUuid}` });

// 获取制品仓库地址前缀
export const getRespositoryUrl = (artifactType: any) => defHttp.get({ url: `/tool/artifact-tool/url/${artifactType}` });

// 查询制品仓库代理列表(有过滤条件，可以分页)
export const queryArtifactProxyListFun = (data: any) => defHttp.post({ url: '/tool/artifact-proxy/pageList', data });

// 新增制品仓库代理
export const addArtifactProxyListFun = (data: any) => defHttp.post({ url: '/tool/artifact-proxy', data });

// 查询制品工具列表(有过滤条件)
export const queryArtifactToolListFun = (data: any) => defHttp.post({ url: '/tool/artifact-tool/list', data });

// 删除制品仓库代理
export const deleteArtifactToolListFun = (artifactProxyUuid: string | number) =>
  defHttp.delete({ url: `/tool/artifact-proxy/${artifactProxyUuid}` });

// 查询制品组件列表(有过滤条件)
export const queryArtifactRespositoryComponentListFun = (data: any) =>
  defHttp.post({ url: '/tool/repository-component/list', data });

// 查询制品组件下文件列表
export const getArtifactFileList = (restId: string | number) =>
  defHttp.get({ url: `/tool/repository-component/asset/list/${restId}` });

// 镜像文件构建历史列表
export const getBuildHistoryList = (restId: string | number) =>
  defHttp.get({ url: `/tool/repository-component/asset/build/history/${restId}` });

// 查询镜像仓库命名空间列表(有过滤条件，可以分页)
export const queryArtifactRespositoryNamespaceListFun = (data: any) =>
  defHttp.post({ url: '/tool/artifact-namespace/pageList', data });

// 更新镜像仓库命名空间
export const putArtifactRespositoryNamespaceList = (data: any) =>
  defHttp.put({ url: '/tool/artifact-namespace', data });

// 删除镜像仓库命名空间
export const deleteArtifactRespositoryNamespaceListFun = (uuid: string | number) =>
  defHttp.delete({ url: `/tool/artifact-namespace/${uuid}` });

// 新增镜像仓库命名空间
export const addArtifactRespositoryNamespaceListFun = (data: any) =>
  defHttp.post({ url: '/tool/artifact-namespace', data });
